$(document).ready(function () {

    /*添加菜单*/
    $('#data-wrapper .btn-4-add').off('click').on('click', function () {
        ajaxSubmitResponseHtm({
            container: '#pop-wrapper',
            url: 'menu/edit.htm'
        });
    });

    /*修改菜单*/
    $('#data-wrapper .btn-4-modify').off('click').on('click', function () {
        var id = $(this).data('id');
        if (id) {
            ajaxSubmitResponseHtm({
                container: '#pop-wrapper',
                url: 'menu/edit.htm',
                data: 'id=' + id
            });
        }
    });

    /*删除菜单*/
    $('#data-wrapper .btn-4-delete').off('click').on('click', function () {
        var id = $(this).data('id');
        if (id) {
            layer.confirm('确认删除？',
                {icon: 3, title: '删除提示', btn: ['确认', '取消']},
                function () {
                    ajaxSubmitResponseJSON({
                        url: 'menu/delete.htm/' + id,
                        success: function (data) {
                            if (data.status == 0) {
                                ajaxSubmitResponseHtm({
                                    url: 'menu/query.htm'
                                });
                            }
                        }
                    });
                }
            );
        }
    });

});